package com.qida.clm.core.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import android.text.TextUtils;

public class RegexUtils {
	
	private static final String EMAIL = "^([a-zA-Z0-9_\\-\\.]+)"
			+ "@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))"
			+ "([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
	/**
	 * 检查email是否有效
	 * @param email
	 * @return
	 */
	public static boolean isEmail(String email) {
		if(TextUtils.isEmpty(email)){
			return false;
		}
		Pattern p = Pattern.compile(EMAIL);
		Matcher m = p.matcher(email);
		return m.matches();
	}
}